import {Pipe, PipeTransform} from '@angular/core';

@Pipe({
  name: 'text'
})
export class TextPipe implements PipeTransform {
  transform(value: string, ...args: any[]): any {
    let len = 20;
    if (args[0]) {
      len = args[0];
    }
    if (value.length > len) {
      return value.substring(0, len) + '...';
    }
    return value;
  }

}
